$(function() {
	$( "#arrange" ).dialog({
        autoOpen: false,
        height:630,
        width:530
    });
	
	$( "#addteacher" ).dialog({
        autoOpen: false,
        height:200,
        width:300
    });
	
	$( "#teacherlist" ).dialog({
        autoOpen: false,
        height:400,
        width:350
    });
	//授课地点窗口
	$( "#placelist" ).dialog({
        autoOpen: false,
        height:300,
        width:350
    });
	
	$( "#tjkc" ).dialog({
        autoOpen: false,
        height:200,
        width:300
    });
	
	$( "#tjdd" ).dialog({
        autoOpen: false,
        height:250,
        width:350
    });
	//开班窗口
	$( "#kb" ).dialog({
        autoOpen: false,
        height:300,
        width:350
    });
	//课程列表窗口
	$( "#kclist" ).dialog({
        autoOpen: false,
        height:350,
        width:350
    });
	//开班列表窗口
	$( "#classlist" ).dialog({
        autoOpen: false,
        height:400,
        width:410
    });
	//搜索结果窗口
	$( "#seares" ).dialog({
        autoOpen: false,
        height:500,
        width:950
    });
	//搜索窗口
	$( "#searchdialog" ).dialog({
        autoOpen: false,
        height:200,
        width:300,
        position:[$("#search").offset().left,$("#search").offset().top+22],
        buttons: {
        	"搜索": function() {
        		var endt = $("#seadatee").val()!=""?$("#seadatee").val()+" 23:59:59":"";
        		$.get("/course/arrange/searcharrange.do",{startTime:$("#seadates").val(), endTime:endt , teacherId:$("#seartea").val() , classesId:$("#seapla").val() }, function(data){
        			
        			var a = $("#searchresult");
        			a.empty();
        			a.append("<tr><td colspan='5'>"+data.length+"个结果</td></tr>");
        			a.append("<tr><th>时间</th><th>地点</th><th>班级</th><th>课程</th><th>教师</th></tr>");
        			for ( var i = 0; i < data.length; i++) {
        				var time = $.fullCalendar.formatDate(new Date(data[i].startTime), "yyyy-MM-dd")+"&nbsp;&nbsp;&nbsp;&nbsp;"+$.fullCalendar.formatDate(new Date(data[i].startTime), "hh:mm")+"到"+$.fullCalendar.formatDate(new Date(data[i].endTime), "hh:mm");
						a.append( "<tr><td>"+time+"</td><td>"+data[i].classes.place.name+"</td><td>"+data[i].classes.className+"</td><td>"+data[i].course.name+"(No."+data[i].number+")</td><td>"+data[i].teacher.name+"</td></tr>" );
					}
        			$( "#seares" ).dialog("open");
        		},"json");
        	}
        }
    });
	//帐号管理
	$( "#accountm" ).dialog({
		autoOpen: false,
        height:300,
        width:360
	});
});